<template>
  <div>
    <h2>
      测试2----
    </h2>
    <el-button type="text" @click="sisui">点击打开 Dialog</el-button>
    <el-button type="text" @click="sisui1111">新增打开 Dialog</el-button>
    <el-dialog
      v-if="dialogVisible"
      title="打开第一次没有数据，第二次打开才有数据"
      :visible.sync="dialogVisible"
      width="90%"
    >
      <enit ref="zizujian" :from="from" @xufangqing="fengjinyun" />
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="yun">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>

import enit from './enid'
export default {
  components: { enit },
  data() {
    return {
      dialogVisible: false,
      from: {
        name: 'sisu',
        age: 85
      }
    }
  },
  methods: {
    sisui() {
      this.dialogVisible = !this.dialogVisible
    },
    sisui1111() {
      console.log(this.$refs.zizujian)
      // this.$refs.zizujian.qingchu()
      this.dialogVisible = !this.dialogVisible
    },
    yun() {
      this.$refs.zizujian.amet()
      this.dialogVisible = !this.dialogVisible
    },
    fengjinyun(val) {
      console.log(val)
    }
  }
}
</script>

<style>

</style>
